package com.ny.entity;

import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

@Data
@Document(collection = "device") // 绑定device集合
public class Device {
    @Field("device_id")
    private Integer deviceId;

    @Field("device_name") // 对应文档中的device_name字段
    private String deviceName;

    @Field("device_type")
    private Integer deviceType; // 1-灯光，2-空调等

    @Field("status")
    private Integer status; // 0-离线，1-在线

    @Field("room_id")
    private Integer roomId;
    
    @Field("device_sn")
    private String deviceSn;
    
    @Field("protocol")
    private String protocol;
    
    @Field("created_time")
    private Date createdTime;

    // 添加无参构造函数
    public Device() {
    }

    // 添加全参构造函数
    public Device(Integer deviceId, String deviceName, Integer deviceType, Integer status, Integer roomId, String deviceSn, String protocol, Date createdTime) {
        this.deviceId = deviceId;
        this.deviceName = deviceName;
        this.deviceType = deviceType;
        this.status = status;
        this.roomId = roomId;
        this.deviceSn = deviceSn;
        this.protocol = protocol;
        this.createdTime = createdTime;
    }
}